from pyecharts.charts import Pie
from pyecharts import options as opts
from pyecharts.faker import Faker

# 生成数据
x = Faker.choose()
print(x)
y = Faker.values()
print(y)
z = list(zip(Faker.choose(), Faker.values()))
print(z)

# 创建饼图对象
c = (
    Pie()
    .add("", [list(t) for t in zip(Faker.choose(), Faker.values())])
    .set_global_opts(title_opts=opts.TitleOpts(title="饼图"))
)

# 渲染图表到HTML文件，可以在浏览器中查看
c.render("pie_chart.html")